#ifndef MYALLOCATOR_H
#define MYALLOCATOR_H

#include <assert.h>
#include <cstddef>
#include <stddef.h>

namespace mystl
{
    template <typename T>
    class allocator
    {
    public:
        typedef T value_type;
        typedef T *pointer;
        typedef const T *const_pointer;
        typedef T &reference;
        typedef const T &const_reference;
        typedef size_t size_type;
        typedef std::ptrdiff_t difference_type;

    public:
        pointer allocate(size_type n=1);
        void deallocate(pointer ptr, size_type n=1);
        //
        allocator() {};
        ~allocator() {};
    };


    //
    template <class T>
    T *allocator<T>::allocate(size_t n)
    {
        if (n == 0)
            return nullptr;
        return static_cast<T *>(::operator new(sizeof(T) * n));
    }
    //
    template <class T>
    void allocator<T>::deallocate(T *ptr, size_t n)
    {
        if (ptr == nullptr)
            return;
        ::operator delete(ptr);
    }
    //

}

#endif // MYALLOCATOR_H